// wchar.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <map>

using namespace std;


int main(int argc, char* argv[])
{
	WCHAR baidu_cnt[ 100 ] = L"http://www.baidu.com/";
	WCHAR *test = wcsstr( baidu_cnt, L"http://");

	WCHAR *test2 = wcstok( baidu_cnt, L"/" );
	
	WCHAR *test3 = wcsstr( baidu_cnt, L"fuck you" );

	size_t p1 = -1;
	
	p1 = wcscspn( baidu_cnt, L"www" );



	if ( p1 == 0 ) {
		WCHAR *test4 = baidu_cnt + 7;
		WCHAR *test5  = wcstok( test4, L"/" );

		wprintf( L"test4: %s", test5 );
	}
	
	size_t p2 = wcscspn( baidu_cnt, L"/" );

	size_t p3 = wcscspn( baidu_cnt, L"h" );


	wprintf( L"test: %s p1: %d\n", test, p1 );
	wprintf( L"test2:%s\n", test2 );

	if ( test3 ) {
		wprintf( L"fuck you!" );
	}

	
//	char *test = lpReturenedString + ( strlen( lpReturenedString ) + 1 );


	TCHAR *pBuffer = new TCHAR[ 2046 ];
	TCHAR *pOldBuffer = pBuffer;
	TCHAR temp[ 100 ];
	GetProfileSection( "ext_demo", pBuffer, 2046 );
	
	int cnt = -1;
	while( pBuffer[0] != 0 ) {
		cnt = atoi( strstr( pBuffer, "=" ) + 1 );
		if ( cnt > 10 ) {
			printf( "%s\n", pBuffer );
		}
		pBuffer = pBuffer + strlen( pBuffer ) + 1;
	}
	delete pOldBuffer;
	
	string s( "hehe" );
	return 0;
}




